<?php

namespace app\home\validate;

use think\Validate;

class Domain extends Validate {

    /**
     * 规则定义
     * @var array
     */
    protected $rule = [
        'id'           => 'number|between:1,10000000',
        'httpProtocol' => ['regex'=>'/^(http|https)$/i'],
        'domainName'   => 'require|length:3,50',
        'httpsPem'     => 'length:10,50000',
        'httpsKey'     => 'length:10,50000',
    ];

    /**
     * 提示信息定义
     * @var array
     */
    protected $message = [
        'id'           => 'ID参数类型不对',
        'httpProtocol' => '请选择http或者https协议',
        'domainName'   => '请输入3-50字符域名地址',
        'httpsPem'     => '请输入10-50000字符https pem证书',
        'httpsKey'     => '请输入10-50000字符https key证书',
    ];

    /**
     * 场景定义
     * @var array
     */
    public $scene = [
        'operateAjax' => ['httpProtocol', 'domainName', 'httpsPem', 'httpsKey'],
        'del'         => ['id'],
    ];
}